<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:t="http://myfaces.apache.org/tomahawk">
<head>
<title>Student List</title>
</head>
<body>
<ui:composition template="/template_top_left.xhtml">
	<ui:define name="center">
		<h:form id="form2">
			<h:panelGrid columns="1">
				<t:dataTable 
				id="data" 
				var="student"
				headerClass="table_header"
				rowClasses="table_row1,table_row2"
				columnClasses="table_col1,table_col2,table_col3,table_col4,table_col5"
				preserveDataModel="true"
				value="#{students.dataModel}" 
				rows="#{students.rowsPerPage}"
				sortColumn="#{students.dataModel.sort}"
                sortAscending="#{students.dataModel.ascending}"
                preserveSort="false">
                	<f:facet name="header">
                		<t:outputText value="#{example_messages['student_table_header']}"/>
                	</f:facet>
					<t:column>
						<f:facet name="header">
							<t:commandSortHeader columnName="Id" immediate="false"
								arrow="true">
								<h:outputText value="#{example_messages['student_id']}"/> 
							</t:commandSortHeader>
						</f:facet>
						<t:outputText value="#{student.id}" />
					</t:column>
					<t:column>
						<f:facet name="header">
							<t:commandSortHeader columnName="Name" immediate="false"
								arrow="true">
								<h:outputText value="#{example_messages['student_name']}"/>
							</t:commandSortHeader>
						</f:facet>
						<t:outputText value="#{student.name}" />
					</t:column>					
					<t:column>
						<f:facet name="header">
							<t:commandSortHeader columnName="LastName" immediate="false"
								arrow="true">
								<h:outputText value="#{example_messages['student_lastname']}"/>
							</t:commandSortHeader>
						</f:facet>
						<t:outputText value="#{student.lastName}" />
					</t:column>					
					<t:column>
						<f:facet name="header">
							<t:commandSortHeader columnName="DateOfBirth" immediate="false"
								arrow="true">
								<h:outputText value="#{example_messages['student_dateofbirth']}"/>
							</t:commandSortHeader>
						</f:facet>
						<h:outputFormat value="{0,date,yyyy-MM-dd}">
							<f:param value= "#{student.dateOfBirth}"/>
						</h:outputFormat>
					</t:column>					
					<t:column>
						<f:facet name="header">
							<t:commandSortHeader columnName="Phone" immediate="false"
								arrow="true">
								<h:outputText value="#{example_messages['student_phone']}"/>
							</t:commandSortHeader>
						</f:facet>
						<t:outputText value="#{student.phone}" />
					</t:column>
					<t:column>
						<f:facet name="header">
						</f:facet>
						<t:commandLink value="Update" action="#{students.update}">
							<f:param name="student" value="#{student.id}"/>
						</t:commandLink>
					</t:column>
					<t:column>
						<f:facet name="header">
						</f:facet>
						<t:commandLink value="Delete" action="#{students.remove}">
							<f:param name="student" value="#{student.id}"/>
						</t:commandLink>
					</t:column>					
				</t:dataTable>
        	    <t:dataScroller 
            		id="scroll_1"
                    for="data"
                    fastStep="10"
                    pageCountVar="pageCount"
                    pageIndexVar="pageIndex"
                    paginator="true"
                    paginatorMaxPages="9"
                    paginatorActiveColumnStyle="font-weight:bold;"
                    immediate="true"
                    >
	                <f:facet name="first" >
    	                <t:graphicImage url="images/arrow-first.gif" border="1" />
        	        </f:facet>
            	    <f:facet name="last">
                	    <t:graphicImage url="images/arrow-last.gif" border="1" />
	                </f:facet>
    		        <f:facet name="previous">
            	        <t:graphicImage url="images/arrow-previous.gif" border="1" />
                	</f:facet>
					<f:facet name="next">
						<t:graphicImage url="images/arrow-next.gif" border="1" />
					</f:facet>
					<f:facet name="fastforward">
						<t:graphicImage url="images/arrow-ff.gif" border="1" />
					</f:facet>
					<f:facet name="fastrewind">
						<t:graphicImage url="images/arrow-fr.gif" border="1" />
					</f:facet>
				</t:dataScroller>
				<t:dataScroller id="scroll_2" for="data" rowsCountVar="rowsCount"
					displayedRowsCountVar="displayedRowsCountVar"
					firstRowIndexVar="firstRowIndex" lastRowIndexVar="lastRowIndex"
					pageCountVar="pageCount" pageIndexVar="pageIndex">
					<h:outputFormat value="#{example_messages['dataScroller_pages']}"
						styleClass="standard">
						<f:param value="#{rowsCount}" />
						<f:param value="#{displayedRowsCountVar}" />
						<f:param value="#{firstRowIndex}" />
						<f:param value="#{lastRowIndex}" />
						<f:param value="#{pageIndex}" />
						<f:param value="#{pageCount}" />
					</h:outputFormat>
				</t:dataScroller>
			</h:panelGrid>		
		</h:form>
	</ui:define>
</ui:composition>
</body>
</html>
